# -*- coding:utf-8 -*-
__author__: 'Rvelamen'
__data__ = '2022/3/18 17:14'

from sqlalchemy import Column, Integer, String, TIMESTAMP, func, Boolean, text, ForeignKey

from .base import BaseModel


class User(BaseModel):
    """ 用户表 """
    id = Column(Integer, primary_key=True, autoincrement=True, index=True, comment='编号')

    name = Column(String(10), nullable=False, index=True, comment='姓名')

    address = Column(String(20), server_default=text("'广东省广州市'"), comment='地址')

    hashed_password = Column(String(60), nullable=False, comment='密码')

    is_active = Column(Boolean(), default=True, comment='是否登录')

    def __repr__(self):
        return f'username : {self.name}'